package com.gzw.dms.map;

import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.text.InputType;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.gzw.dms.R;
import com.gzw.dms.base.BaseActivity;

public class TJSelectActivity extends BaseActivity {
    private Toolbar toolbar;
    private EditText et_end_dress, et_phone, et_driverName, et_username;
    private Context mContext;
    private Button btn_select;
    private Intent mIntent;
    private String fpstste;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void setContentView() {
        setContentView(R.layout.activity_tjselect2);

    }
    @Override
    protected void initViews() {
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        et_username = (EditText) findViewById(R.id.et_username);
        et_phone = (EditText) findViewById(R.id.et_phone);
        et_phone.setInputType(InputType.TYPE_CLASS_NUMBER);
        et_end_dress = (EditText) findViewById(R.id.et_end_dress);
        et_driverName = (EditText) findViewById(R.id.et_driverName);

        btn_select = (Button) findViewById(R.id.btn_select);


    }

    @Override
    protected void initData() {
        mContext = this;
        mIntent = getIntent();
        toolbar.setTitle("条件查询");
        setSupportActionBar(toolbar);

    }

    @Override
    protected void initEvents() {
        toolbar.setNavigationOnClickListener(new myOnClick());
        btn_select.setOnClickListener(new myOnClick());


    }

    class myOnClick implements View.OnClickListener {
        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            switch (v.getId()) {
                case R.id.btn_select:
                    sendData();
                    break;
                default:
                    finish();
                    break;
            }
        }

        private void sendData() {
            Intent mIntent = new Intent();
            //把返回数据存入Intent
            mIntent.putExtra("driver_name1", et_driverName.getText().toString());
            mIntent.putExtra("driver_phone1", et_phone.getText().toString());
            mIntent.putExtra("driver_username1", et_username.getText().toString());
            mIntent.putExtra("driver_address1", et_end_dress.getText().toString());

            //设置返回数据
            setResult(2, mIntent);
            finish();
        }
    }
}